/*
 * 5/14/2012
 *
 * NXCTokenMaker.java - An object that can take a chunk of text and
 * return a linked list of tokens representing it in the NXC programming
 * language.
 * 
 * 
 */
package org.fife.ui.rsyntaxtextarea.modes;

import java.io.*;
import javax.swing.text.Segment;

import org.fife.ui.rsyntaxtextarea.*;


/**
 * Scanner for the NXC programming language.
 *
 * This implementation was created using
 * <a href="http://www.jflex.de/">JFlex</a> 1.4.1; however, the generated file
 * was modified for performance.  Memory allocation needs to be almost
 * completely removed to be competitive with the handwritten lexers (subclasses
 * of <code>AbstractTokenMaker</code>, so this class has been modified so that
 * Strings are never allocated (via yytext()), and the scanner never has to
 * worry about refilling its buffer (needlessly copying chars around).
 * We can achieve this because RText always scans exactly 1 line of tokens at a
 * time, and hands the scanner this line as an array of characters (a Segment
 * really).  Since tokens contain pointers to char arrays instead of Strings
 * holding their contents, there is no need for allocating new memory for
 * Strings.<p>
 *
 * The actual algorithm generated for scanning has, of course, not been
 * modified.<p>
 *
 * If you wish to regenerate this file yourself, keep in mind the following:
 * <ul>
 *   <li>The generated <code>CTokenMaker.java</code> file will contain two
 *       definitions of both <code>zzRefill</code> and <code>yyreset</code>.
 *       You should hand-delete the second of each definition (the ones
 *       generated by the lexer), as these generated methods modify the input
 *       buffer, which we'll never have to do.</li>
 *   <li>You should also change the declaration/definition of zzBuffer to NOT
 *       be initialized.  This is a needless memory allocation for us since we
 *       will be pointing the array somewhere else anyway.</li>
 *   <li>You should NOT call <code>yylex()</code> on the generated scanner
 *       directly; rather, you should use <code>getTokenList</code> as you would
 *       with any other <code>TokenMaker</code> instance.</li>
 * </ul>
 *
 * @author Robert Futrell, Daniel Larsen
 * @version 1.0
 *
 */
%%

%public
%class NXCTokenMaker
%extends AbstractJFlexNXCTokenMaker
%unicode
%type org.fife.ui.rsyntaxtextarea.Token


%{


	/**
	 * Constructor.  This must be here because JFlex does not generate a
	 * no-parameter constructor.
	 */
	public NXCTokenMaker() {
		super();
	}


	/**
	 * Adds the token specified to the current linked list of tokens.
	 *
	 * @param tokenType The token's type.
	 * @see #addToken(int, int, int)
	 */
	private void addHyperlinkToken(int start, int end, int tokenType) {
		int so = start + offsetShift;
		addToken(zzBuffer, start,end, tokenType, so, true);
	}


	/**
	 * Adds the token specified to the current linked list of tokens.
	 *
	 * @param tokenType The token's type.
	 */
	private void addToken(int tokenType) {
		addToken(zzStartRead, zzMarkedPos-1, tokenType);
	}


	/**
	 * Adds the token specified to the current linked list of tokens.
	 *
	 * @param tokenType The token's type.
	 */
	private void addToken(int start, int end, int tokenType) {
		int so = start + offsetShift;
		addToken(zzBuffer, start,end, tokenType, so);
	}


	/**
	 * Adds the token specified to the current linked list of tokens.
	 *
	 * @param array The character array.
	 * @param start The starting offset in the array.
	 * @param end The ending offset in the array.
	 * @param tokenType The token's type.
	 * @param startOffset The offset in the document at which this token
	 *                    occurs.
	 */
	public void addToken(char[] array, int start, int end, int tokenType, int startOffset) {
		super.addToken(array, start,end, tokenType, startOffset);
		zzStartRead = zzMarkedPos;
	}


	/**
	 * Returns the text to place at the beginning and end of a
	 * line to "comment" it in a this programming language.
	 *
	 * @return The start and end strings to add to a line to "comment"
	 *         it out.
	 */
	public String[] getLineCommentStartAndEnd() {
		return new String[] { "//", null };
	}


	/**
	 * Returns the first token in the linked list of tokens generated
	 * from <code>text</code>.  This method must be implemented by
	 * subclasses so they can correctly implement syntax highlighting.
	 *
	 * @param text The text from which to get tokens.
	 * @param initialTokenType The token type we should start with.
	 * @param startOffset The offset into the document at which
	 *                    <code>text</code> starts.
	 * @return The first <code>Token</code> in a linked list representing
	 *         the syntax highlighted text.
	 */
	public Token getTokenList(Segment text, int initialTokenType, int startOffset) {

		resetTokenList();
		this.offsetShift = -text.offset + startOffset;

		// Start off in the proper state.
		int state = Token.NULL;
		switch (initialTokenType) {
			case Token.COMMENT_MULTILINE:
				state = MLC;
				start = text.offset;
				break;
			default:
				state = Token.NULL;
		}

		s = text;
		try {
			yyreset(zzReader);
			yybegin(state);
			return yylex();
		} catch (IOException ioe) {
			ioe.printStackTrace();
			return new DefaultToken();
		}

	}


	/**
	 * Refills the input buffer.
	 *
	 * @return      <code>true</code> if EOF was reached, otherwise
	 *              <code>false</code>.
	 * @exception   IOException  if any I/O-Error occurs.
	 */
	private boolean zzRefill() throws java.io.IOException {
		return zzCurrentPos>=s.offset+s.count;
	}


	/**
	 * Resets the scanner to read from a new input stream.
	 * Does not close the old reader.
	 *
	 * All internal variables are reset, the old input stream 
	 * <b>cannot</b> be reused (internal buffer is discarded and lost).
	 * Lexical state is set to <tt>YY_INITIAL</tt>.
	 *
	 * @param reader   the new input stream 
	 */
	public final void yyreset(java.io.Reader reader) throws java.io.IOException {
		// 's' has been updated.
		zzBuffer = s.array;
		/*
		 * We replaced the line below with the two below it because zzRefill
		 * no longer "refills" the buffer (since the way we do it, it's always
		 * "full" the first time through, since it points to the segment's
		 * array).  So, we assign zzEndRead here.
		 */
		//zzStartRead = zzEndRead = s.offset;
		zzStartRead = s.offset;
		zzEndRead = zzStartRead + s.count - 1;
		zzCurrentPos = zzMarkedPos = zzPushbackPos = s.offset;
		zzLexicalState = YYINITIAL;
		zzReader = reader;
		zzAtBOL  = true;
		zzAtEOF  = false;
	}


%}

Letter				= [A-Za-z]
LetterOrUnderscore	= ({Letter}|[_])
Digit				= [0-9]
HexDigit			= {Digit}|[A-Fa-f]
OctalDigit			= [0-7]
Exponent			= [eE][+-]?{Digit}+

PreprocessorWord	= define|elif|else|endif|error|if|ifdef|ifndef|include|line|pragma|undef

Trigraph				= ("??="|"??("|"??)"|"??/"|"??'"|"??<"|"??>"|"??!"|"??-")

OctEscape1			= ([\\]{OctalDigit})
OctEscape2			= ([\\]{OctalDigit}{OctalDigit})
OctEscape3			= ([\\][0-3]{OctalDigit}{OctalDigit})
OctEscape				= ({OctEscape1}|{OctEscape2}|{OctEscape3})
HexEscape				= ([\\][xX]{HexDigit}{HexDigit})

AnyChrChr					= ([^\'\n\\])
Escape					= ([\\]([abfnrtv\'\"\?\\0]))
UnclosedCharLiteral			= ([\']({Escape}|{OctEscape}|{HexEscape}|{Trigraph}|{AnyChrChr}))
CharLiteral				= ({UnclosedCharLiteral}[\'])
ErrorUnclosedCharLiteral		= ([\'][^\'\n]*)
ErrorCharLiteral			= (([\'][\'])|{ErrorUnclosedCharLiteral}[\'])
AnyStrChr					= ([^\"\n\\])
FalseTrigraph				= (("?"(("?")*)[^\=\(\)\/\'\<\>\!\-\\\?\"\n])|("?"[\=\(\)\/\'\<\>\!\-]))
StringLiteral				= ([\"]((((("?")*)({Escape}|{OctEscape}|{HexEscape}|{Trigraph}))|{FalseTrigraph}|{AnyStrChr})*)(("?")*)[\"])
UnclosedStringLiteral		= ([\"]([\\].|[^\\\"])*[^\"]?)
ErrorStringLiteral			= ({UnclosedStringLiteral}[\"])


LineTerminator		= \n
WhiteSpace		= [ \t\f]

MLCBegin			= "/*"
MLCEnd			= "*/"
LineCommentBegin	= "//"

NonFloatSuffix		= (([uU][lL]?)|([lL][uU]?))
IntegerLiteral		= ({Digit}+{Exponent}?{NonFloatSuffix}?)
HexLiteral		= ("0"[xX]{HexDigit}+{NonFloatSuffix}?)
FloatLiteral		= ((({Digit}*[\.]{Digit}+)|({Digit}+[\.]{Digit}*)){Exponent}?[fFlL]?)
ErrorNumberFormat	= (({IntegerLiteral}|{HexLiteral}|{FloatLiteral}){NonSeparator}+)

NonSeparator		= ([^\t\f\r\n\ \(\)\{\}\[\]\;\,\.\=\>\<\!\~\?\:\+\-\*\/\&\|\^\%\"\']|"#")
Identifier		= ({LetterOrUnderscore}({LetterOrUnderscore}|{Digit}|[$])*)
ErrorIdentifier	= ({NonSeparator}+)


URLGenDelim				= ([:\/\?#\[\]@])
URLSubDelim				= ([\!\$&'\(\)\*\+,;=])
URLUnreserved			= ({LetterOrUnderscore}|{Digit}|[\-\.\~])
URLCharacter			= ({URLGenDelim}|{URLSubDelim}|{URLUnreserved}|[%])
URLCharacters			= ({URLCharacter}*)
URLEndCharacter			= ([\/\$]|{Letter}|{Digit})
URL						= (((https?|f(tp|ile))"://"|"www.")({URLCharacters}{URLEndCharacter})?)

%state MLC
%state EOL_COMMENT

%%

<YYINITIAL> {

	/* Keywords */
	"auto" |
	"break" |
	"case" |
	"const" |
	"continue" |
	"default" |
	"do" |
	"else" |
	"enum" |
	"extern" |
	"for" |
	"goto" |
	"if" |
	"register" |
	"return" |
	"sizeof" |
	"static" |
	"struct" |
	"switch" |
	"typedef" |
	"union" |
	"volatile" |
	"while"					{ addToken(Token.RESERVED_WORD); }

	/* Data types. */
	"char" |
	"div_t" |
	"double" |
	"float" |
	"int" |
	"ldiv_t" |
	"long" |
	"short" |
	"signed" |
	"size_t" |
	"unsigned" |
	"void" |
	"wchar_t"				{ addToken(Token.DATA_TYPE); }

	/* Standard functions */
	"abort" |
	"AbortFlag" |
	"abs" |
	"acos" |
	"acosd" |
	"addressOf" |
	"addressOfEx" |
	"asctime" |
	"asin" |
	"asind" |
	"assert" |
	"atan" |
	"atan2" |
	"atan2d" |
	"atand" |
	"atexit" |
	"atof" |
	"atoi" |
	"atol" |
	"BatteryLevel" |
	"BatteryState" |
	"bcd2dec" |
	"BluetoothState" |
	"BluetoothStatus" |
	"BluetoothWrite" |
	"BrickDataBluecoreVersion" |
	"BrickDataBtHardwareStatus" |
	"BrickDataBtStateStatus" |
	"BrickDataName" |
	"BrickDataTimeoutValue" |
	"bsearch" |
	"BTConnectionClass" |
	"BTConnectionHandleNum" |
	"BTConnectionLinkQuality" |
	"BTConnectionName" |
	"BTConnectionPinCode" |
	"BTConnectionStreamStatus" |
	"BTDataMode" |
	"BTDeviceClass" |
	"BTDeviceCount" |
	"BTDeviceName" |
	"BTDeviceNameCount" |
	"BTDeviceStatus" |
	"BTInputBufferInPtr" |
	"BTInputBufferOutPtr" |
	"BTN1" |
	"BTN2" |
	"BTN3" |
	"BTN4" |
	"BTNCENTER" |
	"BTNEXIT" |
	"BTNLEFT" |
	"BTNRIGHT" |
	"BTNSTATE_LONG_PRESSED_EV" |
	"BTNSTATE_LONG_RELEASED_EV" |
	"BTNSTATE_NONE" |
	"BTNSTATE_PRESSED_EV" |
	"BTNSTATE_PRESSED_STATE" |
	"BTNSTATE_SHORT_RELEASED_EV" |
	"BTOutputBufferInPtr" |
	"BTOutputBufferOutPtr" |
	"btowc" |
	"ButtonCount" |
	"ButtonLongPressCount" |
	"ButtonLongReleaseCount" |
	"ButtonPressCount" |
	"ButtonPressed" |
	"ButtonReleaseCount" |
	"ButtonShortReleaseCount" |
	"ButtonState" |
	"ByteArrayToStr" |
	"ByteArrayToStrEx" |
	"calloc" |
	"ceil" |
	"CircleOut" |
	"clearerr" |
	"ClearLine" |
	"ClearScreen" |
	"ClearSensor" |
	"clock" |
	"CloseFile" |
	"Coast" |
	"CoastEx" |
	"ColorADRaw" |
	"ColorBoolean" |
	"ColorCalibration" |
	"ColorCalibrationState" |
	"ColorCalLimits" |
	"ColorSensorRaw" |
	"ColorSensorReadType" |
	"ColorSensorValue" |
	"CommandFlags" |
	"CommBTCheckStatusType" |
	"CommBTConnectionType" |
	"CommBTOnOffType" |
	"CommBTWriteType" |
	"CommExecuteFunctionType" |
	"CommHSCheckStatusType" |
	"CommHSControlType" |
	"CommHSReadWriteType" |
	"CommLSCheckStatusType" |
	"CommLSReadType" |
	"CommLSWriteExType" |
	"CommLSWriteType" |
	"ComputeCalibValueType" |
	"ConfigureTemperatureSensor" |
	"Copy" |
	"cos" |
	"cosd" |
	"cosh" |
	"coshd" |
	"CreateFile" |
	"CreateFileLinear" |
	"CreateFileNonLinear" |
	"ctime" |
	"CustomSensorActiveStatus" |
	"CustomSensorPercentFullScale" |
	"CustomSensorZeroOffset" |
	"DatalogGetTimesType" |
	"DatalogWriteType" |
	"DeleteFile" |
	"difftime" |
	"DisplayContrast" |
	"DisplayDisplay" |
	"DisplayEraseMask" |
	"DisplayExecuteFunctionType" |
	"DisplayFlags" |
	"DisplayFont" |
	"DisplayTextLinesCenterFlags" |
	"DisplayUpdateMask" |
	"div" |
	"div_t" |
	"DrawCircleType" |
	"DrawEllipseType" |
	"DrawFontType" |
	"DrawGraphicArrayType" |
	"DrawGraphicType" |
	"DrawLineType" |
	"DrawPointType" |
	"DrawPolygonType" |
	"DrawRectType" |
	"DrawTextType" |
	"EllipseOut" |
	"errno" |
	"exit" |
	"exp" |
	"fabs" |
	"fclose" |
	"feof" |
	"ferror" |
	"fflush" |
	"fgetc" |
	"fgetpos" |
	"fgets" |
	"fgetwc" |
	"fgetws" |
	"FileCloseType" |
	"FileDeleteType" |
	"FileFindType" |
	"FileOpenType" |
	"FileReadWriteType" |
	"FileRenameType" |
	"FileResizeType" |
	"FileResolveHandleType" |
	"FileSeekType" |
	"FileTellType" |
	"FindFirstFile" |
	"FindNextFile" |
	"Flatten" |
	"FlattenVar" |
	"Float" |
	"floor" |
	"fmod" |
	"FontNumOut" |
	"FontTextOut" |
	"fopen" |
	"ForceOff" |
	"FormatNum" |
	"fprintf" |
	"fputc" |
	"fputs" |
	"fputwc" |
	"fputws" |
	"frac" |
	"fread" |
	"free" |
	"FreeMemory" |
	"freopen" |
	"frexp" |
	"fscanf" |
	"fseek" |
	"fsetpos" |
	"ftell" |
	"fwprintf" |
	"fwrite" |
	"fwscanf" |
	"GetBrickDataAddress" |
	"GetBTConnectionAddress" |
	"GetBTDeviceAddress" |
	"GetBTInputBuffer" |
	"GetBTOutputBuffer" |
	"getc" |
	"getchar" |
	"GetDisplayNormal" |
	"GetDisplayPopup" |
	"getenv" |
	"GetHSInputBuffer" |
	"GetHSOutputBuffer" |
	"GetInput" |
	"GetOutput" |
	"gets" |
	"GetStartTickType" |
	"GetUSBInputBuffer" |
	"GetUSBOutputBuffer" |
	"GetUSBPollBuffer" |
	"getwc" |
	"getwchar" |
	"gmtime" |
	"GraphicArrayOut" |
	"GraphicArrayOutEx" |
	"GraphicOut" |
	"GraphicOutEx" |
	"HSDataMode" |
	"HSFlags" |
	"HSInputBufferInPtr" |
	"HSInputBufferOutPtr" |
	"HSMode" |
	"HSOutputBufferInPtr" |
	"HSOutputBufferOutPtr" |
	"HSSpeed" |
	"HSState" |
	"I2CBytes" |
	"I2CBytesReady" |
	"I2CCheckStatus" |
	"I2CDeviceId" |
	"I2CDeviceInfo" |
	"I2CRead" |
	"I2CSendCommand" |
	"I2CStatus" |
	"I2CVendorId" |
	"I2CVersion" |
	"I2CWrite" |
	"InputValuesType" |
	"IOMapReadByIDType" |
	"IOMapReadType" |
	"IOMapWriteByIDType" |
	"IOMapWriteType" |
	"isalnum" |
	"isalpha" |
	"iscntrl" |
	"isdigit" |
	"isgraph" |
	"islower" |
	"isNAN" |
	"isprint" |
	"ispunct" |
	"isspace" |
	"isupper" |
	"isxdigit" |
	"KeepAliveType" |
	"labs" |
	"ldexp" |
	"ldiv" |
	"ldiv_t" |
	"LeftStr" |
	"LineOut" |
	"ListFilesType" |
	"LoaderExecuteFunctionType" |
	"localeconv" |
	"localtime" |
	"LocationType" |
	"log" |
	"log10" |
	"LongAbort" |
	"longjmp" |
	"LowspeedBytesReady" |
	"LowspeedCheckStatus" |
	"LowspeedRead" |
	"LowspeedStatus" |
	"LowspeedWrite" |
	"malloc" |
	"mblen" |
	"mbrlen" |
	"mbrtowc" |
	"mbsinit" |
	"mbsrtowcs" |
	"mbstowcs" |
	"mbtowc" |
	"memchr" |
	"memcmp" |
	"memcpy" |
	"memmove" |
	"MemoryManagerType" |
	"memset" |
	"MessageReadType" |
	"MessageWriteType" |
	"MidStr" |
	"mktime" |
	"modf" |
	"MotorActualSpeed" |
	"MotorBlockTachoCount" |
	"MotorMaxAcceleration" |
	"MotorMaxSpeed" |
	"MotorMode" |
	"MotorOutputOptions" |
	"MotorOverload" |
	"MotorPower" |
	"MotorPwnFreq" |
	"MotorRegDValue" |
	"MotorRegIValue" |
	"MotorRegPValue" |
	"MotorRegulation" |
	"MotorRegulationOptions" |
	"MotorRegulationTime" |
	"MotorRotationCount" |
	"MotorRunState" |
	"MotorTachoCount" |
	"MotorTachoLimit" |
	"MotorTurnRatio" |
	"muldiv32" |
	"NO_OF_BTNS" |
	"NumOut" |
	"NumToStr" |
	"Off" |
	"OffEx" |
	"offsetof" |
	"OnBrickProgramPointer" |
	"OnFwd" |
	"OnFwdEx" |
	"OnFwdReg" |
	"OnFwdRegEx" |
	"OnFwdRegExPID" |
	"OnFwdRegPID" |
	"OnFwdSync" |
	"OnFwdSyncEx" |
	"OnFwdSyncExPID" |
	"OnFwdSyncPID" |
	"OnRev" |
	"OnRevEx" |
	"OnRevReg" |
	"OnRevRegEx" |
	"OnRevRegExPID" |
	"OnRevRegPID" |
	"OnRevSync" |
	"OnRevSyncEx" |
	"OnRevSyncExPID" |
	"OnRevSyncPID" |
	"OpenFileAppend" |
	"OpenFileRead" |
	"OpenFileReadLinear" |
	"OutputStateType" |
	"perror" |
	"PlayFile" |
	"PlayFileEx" |
	"PlaySound" |
	"PlayTone" |
	"PlayToneEx" |
	"PlayTones" |
	"PointOut" |
	"PolyOut" |
	"Pos" |
	"PosRegAddAngle" |
	"PosRegEnable" |
	"PosRegSetAngle" |
	"PosRegSetMax" |
	"pow" |
	"PowerDown" |
	"printf" |
	"putc" |
	"putchar" |
	"puts" |
	"putwc" |
	"putwchar" |
	"qsort" |
	"raise" |
	"rand" |
	"Random" |
	"RandomNumberType" |
	"Read" |
	"ReadButtonEx" |
	"ReadButtonType" |
	"ReadBytes" |
	"ReadI2CRegister" |
	"ReadLastResponseType" |
	"ReadLn" |
	"ReadLnString" |
	"ReadSemDataType" |
	"ReadSensorColorEx" |
	"ReadSensorColorRaw" |
	"ReadSensorEMeter" |
	"ReadSensorUSEx" |
	"realloc" |
	"RebootInFirmwareMode" |
	"ReceiveMessage" |
	"ReceiveRemoteBool" |
	"ReceiveRemoteMessageEx" |
	"ReceiveRemoteNumber" |
	"ReceiveRemoteString" |
	"RechargeableBattery" |
	"RectOut" |
	"reladdressOf" |
	"RemoteConnectionIdle" |
	"RemoteConnectionWrite" |
	"remove" |
	"rename" |
	"RenameFile" |
	"ResetAllTachoCounts" |
	"ResetBlockTachoCount" |
	"ResetRotationCount" |
	"ResetScreen" |
	"ResetSensor" |
	"ResetTachoCount" |
	"ResizeFile" |
	"ResolveHandle" |
	"rewind" |
	"RightStr" |
	"RotateMotor" |
	"RotateMotorEx" |
	"RotateMotorExPID" |
	"RotateMotorPID" |
	"RS485Control" |
	"RS485DataAvailable" |
	"RS485Disable" |
	"RS485Enable" |
	"RS485Initialize" |
	"RS485Read" |
	"RS485SendingData" |
	"RS485Status" |
	"RS485Uart" |
	"RS485Write" |
	"scanf" |
	"SendMessage" |
	"SendRemoteBool" |
	"SendRemoteNumber" |
	"SendRemoteString" |
	"SendResponseBool" |
	"SendResponseNumber" |
	"SendResponseString" |
	"SendRS485Bool" |
	"SendRS485Number" |
	"SendRS485String" |
	"Sensor" |
	"SensorBoolean" |
	"SensorDigiPinsDirection" |
	"SensorDigiPinsOutputLevel" |
	"SensorDigiPinsStatus" |
	"SensorInvalid" |
	"SensorMode" |
	"SensorNormalized" |
	"SensorRaw" |
	"SensorScaled" |
	"SensorTemperature" |
	"SensorType" |
	"SensorUS" |
	"SensorValue" |
	"SensorValueBool" |
	"SensorValueRaw" |
	"SetAbortFlag" |
	"SetBatteryState" |
	"SetBluetoothState" |
	"SetBTDataMode" |
	"SetBTInputBuffer" |
	"SetBTInputBufferInPtr" |
	"SetBTInputBufferOutPtr" |
	"SetBTOutputBuffer" |
	"SetBTOutputBufferInPtr" |
	"SetBTOutputBufferOutPtr" |
	"setbuf" |
	"SetButtonLongPressCount" |
	"SetButtonLongReleaseCount" |
	"SetButtonPressCount" |
	"SetButtonReleaseCount" |
	"SetButtonShortReleaseCount" |
	"SetButtonState" |
	"SetCommandFlags" |
	"SetCustomSensorActiveStatus" |
	"SetCustomSensorPercentFullScale" |
	"SetCustomSensorZeroOffset" |
	"SetDisplayContrast" |
	"SetDisplayDisplay" |
	"SetDisplayEraseMask" |
	"SetDisplayFlags" |
	"SetDisplayFont" |
	"SetDisplayNormal" |
	"SetDisplayPopup" |
	"SetDisplayTextLinesCenterFlags" |
	"SetDisplayUpdateMask" |
	"SetHSDataMode" |
	"SetHSFlags" |
	"SetHSInputBuffer" |
	"SetHSInputBufferInPtr" |
	"SetHSInputBufferOutPtr" |
	"SetHSMode" |
	"SetHSOutputBuffer" |
	"SetHSOutputBufferInPtr" |
	"SetHSOutputBufferOutPtr" |
	"SetHSSpeed" |
	"SetHSState" |
	"SetInput" |
	"setjmp" |
	"setlocale" |
	"SetLongAbort" |
	"SetMotorPwnFreq" |
	"SetMotorRegulationOptions" |
	"SetMotorRegulationTime" |
	"SetOnBrickProgramPointer" |
	"SetOutput" |
	"SetScreenModeType" |
	"SetSensor" |
	"SetSensorBoolean" |
	"SetSensorColorBlue" |
	"SetSensorColorFull" |
	"SetSensorColorGreen" |
	"SetSensorColorNone" |
	"SetSensorColorRed" |
	"SetSensorDigiPinsDirection" |
	"SetSensorDigiPinsOutputLevel" |
	"SetSensorDigiPinsStatus" |
	"SetSensorEMeter" |
	"SetSensorLight" |
	"SetSensorLowspeed" |
	"SetSensorMode" |
	"SetSensorSound" |
	"SetSensorTemperature" |
	"SetSensorTouch" |
	"SetSensorType" |
	"SetSensorUltrasonic" |
	"SetSleepTime" |
	"SetSleepTimeout" |
	"SetSleepTimeoutType" |
	"SetSleepTimer" |
	"SetSoundDuration" |
	"SetSoundFlags" |
	"SetSoundFrequency" |
	"SetSoundMode" |
	"SetSoundModuleState" |
	"SetSoundSampleRate" |
	"SetSoundVolume" |
	"SetUIButton" |
	"SetUIState" |
	"SetUSBInputBuffer" |
	"SetUSBInputBufferInPtr" |
	"SetUSBInputBufferOutPtr" |
	"SetUSBOutputBuffer" |
	"SetUSBOutputBufferInPtr" |
	"SetUSBOutputBufferOutPtr" |
	"SetUSBPollBuffer" |
	"SetUSBPollBufferInPtr" |
	"SetUSBPollBufferOutPtr" |
	"SetUSBState" |
	"setvbuf" |
	"SetVMRunState" |
	"SetVolume" |
	"set_fopen_size" |
	"sign" |
	"signal" |
	"sin" |
	"sind" |
	"sinh" |
	"sinhd" |
	"SizeOf" |
	"SizeType" |
	"SleepNow" |
	"SleepTime" |
	"SleepTimeout" |
	"SleepTimer" |
	"SoundDuration" |
	"SoundFlags" |
	"SoundFrequency" |
	"SoundGetStateType" |
	"SoundMode" |
	"SoundPlayFileType" |
	"SoundPlayToneType" |
	"SoundSampleRate" |
	"SoundSetStateType" |
	"SoundState" |
	"SoundVolume" |
	"sprintf" |
	"sqrt" |
	"srand" |
	"sscanf" |
	"StopSound" |
	"strcat" |
	"StrCat" |
	"strchr" |
	"strcmp" |
	"strcoll" |
	"strcpy" |
	"strcspn" |
	"strerror" |
	"strftime" |
	"StrIndex" |
	"strlen" |
	"StrLen" |
	"strncat" |
	"strncmp" |
	"strncpy" |
	"strpbrk" |
	"strrchr" |
	"StrReplace" |
	"strspn" |
	"strstr" |
	"StrToByteArray" |
	"strtod" |
	"strtok" |
	"strtol" |
	"StrToNum" |
	"strtoul" |
	"strxfrm" |
	"SubStr" |
	"swprintf" |
	"swscanf" |
	"SysColorSensorRead" |
	"SysCommBTCheckStatus" |
	"SysCommBTConnection" |
	"SysCommBTOnOff" |
	"SysCommBTWrite" |
	"SysCommExecuteFunction" |
	"SysCommHSCheckStatus" |
	"SysCommHSControl" |
	"SysCommHSRead" |
	"SysCommHSWrite" |
	"SysDisplayExecuteFunction" |
	"SysDrawCircle" |
	"SysDrawEllipse" |
	"SysDrawFont" |
	"SysDrawGraphic" |
	"SysDrawGraphicArray" |
	"SysDrawLine" |
	"SysDrawPoint" |
	"SysDrawPolygon" |
	"SysDrawRect" |
	"SysDrawText" |
	"SysFileClose" |
	"SysFileDelete" |
	"SysFileFindFirst" |
	"SysFileFindNext" |
	"SysFileOpenAppend" |
	"SysFileOpenRead" |
	"SysFileOpenReadLinear" |
	"SysFileOpenWrite" |
	"SysFileOpenWriteLinear" |
	"SysFileOpenWriteNonLinear" |
	"SysFileRead" |
	"SysFileRename" |
	"SysFileResize" |
	"SysFileResolveHandle" |
	"SysFileSeek" |
	"SysFileTell" |
	"SysFileWrite" |
	"SysListFiles" |
	"SysLoaderExecuteFunction" |
	"SysMessageRead" |
	"SysMessageWrite" |
	"SysRandomNumber" |
	"SysReadButton" |
	"SysSetScreenMode" |
	"SysSetSleepTimeout" |
	"SysSoundGetState" |
	"SysSoundPlayFile" |
	"SysSoundPlayTone" |
	"SysSoundSetState" |
	"system" |
	"tan" |
	"tand" |
	"tanh" |
	"tanhd" |
	"TextOut" |
	"time" |
	"tmpfile" |
	"tmpnam" |
	"tolower" |
	"Tone" |
	"toupper" |
	"trunc" |
	"UIButton" |
	"UIState" |
	"UnflattenVar" |
	"ungetc" |
	"ungetwc" |
	"UpdateCalibCacheInfoType" |
	"USBInputBufferInPtr" |
	"USBInputBufferOutPtr" |
	"USBOutputBufferInPtr" |
	"USBOutputBufferOutPtr" |
	"USBPollBufferInPtr" |
	"USBPollBufferOutPtr" |
	"UsbState" |
	"USBState" |
	"UseRS485" |
	"va_arg" |
	"va_end" |
	"va_start" |
	"vfprintf" |
	"vfwprintf" |
	"VMRunState" |
	"Volume" |
	"vprintf" |
	"vsprintf" |
	"vswprintf" |
	"vwprintf" |
	"Wait" |
	"wcrtomb" |
	"wcscat" |
	"wcschr" |
	"wcscmp" |
	"wcscoll" |
	"wcscpy" |
	"wcscspn" |
	"wcsftime" |
	"wcslen" |
	"wcsncat" |
	"wcsncmp" |
	"wcsncpy" |
	"wcspbrk" |
	"wcsrchr" |
	"wcsrtombs" |
	"wcsspn" |
	"wcsstr" |
	"wcstod" |
	"wcstok" |
	"wcstol" |
	"wcstombs" |
	"wcstoul" |
	"wcsxfrm" |
	"wctob" |
	"wctomb" |
	"wmemchr" |
	"wmemcmp" |
	"wmemcpy" |
	"wmemmove" |
	"wmemset" |
	"wprintf" |
	"Write" |
	"WriteBytes" |
	"WriteBytesEx" |
	"WriteI2CRegister" |
	"WriteLn" |
	"WriteLnString" |
	"WriteSemDataType" |
	"WriteString" |
	"wscanf"			{ addToken(Token.FUNCTION); }
	
	/* NXC Constants */
	"SENSOR_1" |
	"SENSOR_2" |
	"SENSOR_3" |
	"SENSOR_L" |
	"SENSOR_M" |
	"SENSOR_R" |
	"SENSOR_MODE_RAW" |
	"SENSOR_MODE_BOOL" |
	"SENSOR_MODE_EDGE" |
	"SENSOR_MODE_PULSE" |
	"SENSOR_MODE_PERCENT" |
	"SENSOR_MODE_CELSIUS" |
	"SENSOR_MODE_FAHRENHEIT" |
	"SENSOR_MODE_ROTATION" |
	"SENSOR_TYPE_NONE" |
	"SENSOR_TYPE_TOUCH" |
	"SENSOR_TYPE_TEMPERATURE" |
	"SENSOR_TYPE_LIGHT" |
	"SENSOR_TYPE_ROTATION" |
	"SENSOR_TOUCH" |
	"SENSOR_LIGHT" |
	"SENSOR_ROTATION" |
	"SENSOR_PULSE" |
	"SENSOR_EDGE" |
	"SENSOR_CELSIUS" |
	"SENSOR_FAHRENHEIT" |
	"OUT_A" |
	"OUT_B" |
	"OUT_C" |
	"OUT_AB" |
	"OUT_AC" |
	"OUT_BC" |
	"OUT_ABC" |
	"OUT_L" |
	"OUT_R" |
	"OUT_X" |
	"OUT_OFF" |
	"OUT_ON" |
	"OUT_FLOAT" |
	"OUT_REV" |
	"OUT_TOGGLE" |
	"OUT_FWD" |
	"OUT_FULL" |
	"OUT_LOW" |
	"OUT_HALF" |
	"SOUND_CLICK" |
	"SOUND_DOUBLE_BEEP" |
	"SOUND_DOWN" |
	"SOUND_UP" |
	"SOUND_LOW_BEEP" |
	"SOUND_FAST_UP" |
	"DIRSPEED" |
	"DISPLAY_WATCH" |
	"DISPLAY_SENSOR_1" |
	"DISPLAY_SENSOR_2" |
	"DISPLAY_SENSOR_3" |
	"DISPLAY_OUT_A" |
	"DISPLAY_OUT_B" |
	"DISPLAY_OUT_C" |
	"DISPLAY_USER" |
	"TX_POWER_LO" |
	"TX_POWER_HI" |
	"SERIAL_COMM_DEFAULT" |
	"SERIAL_COMM_4800" |
	"SERIAL_COMM_DUTY25" |
	"SERIAL_COMM_76KHZ" |
	"SERIAL_COMM_RCX" |
	"SERIAL_COMM_RC" |
	"SERIAL_COMM_SPYBOT" |
	"SERIAL_PACKET_DEFAULT" |
	"SERIAL_PACKET_PREAMBLE" |
	"SERIAL_PACKET_NEGATED" |
	"SERIAL_PACKET_CHECKSUM" |
	"SERIAL_PACKET_RCX" |
	"SERIAL_PACKET_RC" |
	"SERIAL_PACKET_SPYBOT" |
	"S1" |
	"S2" |
	"S3" |
	"T1" |
	"T2" |
	"T3" |
	"T4" |
	"ACQUIRE_OUT_A" |
	"ACQUIRE_OUT_B" |
	"ACQUIRE_OUT_C" |
	"ACQUIRE_SOUND" |
	"ACQUIRE_USER_1" |
	"ACQUIRE_USER_2" |
	"ACQUIRE_USER_3" |
	"ACQUIRE_USER_4" |
	"ACQUIRE_LED" |
	"EVENT_TYPE_PRESSED" |
	"EVENT_TYPE_RELEASED" |
	"EVENT_TYPE_PULSE" |
	"EVENT_TYPE_EDGE" |
	"EVENT_TYPE_FASTCHANGE" |
	"EVENT_TYPE_LOW" |
	"EVENT_TYPE_NORMAL" |
	"EVENT_TYPE_HIGH" |
	"EVENT_TYPE_CLICK" |
	"EVENT_TYPE_DOUBLECLICK" |
	"EVENT_TYPE_MESSAGE" |
	"EVENT_TYPE_ENTRY_FOUND" |
	"EVENT_TYPE_MSG_DISCARD" |
	"EVENT_TYPE_MSG_RECEIVED" |
	"EVENT_TYPE_VLL_MSG_RECEIVED" |
	"EVENT_TYPE_ENTRY_CHANGED" |
	"EVENT_1_PRESSED" |
	"EVENT_1_RELEASED" |
	"EVENT_2_PRESSED" |
	"EVENT_2_RELEASED" |
	"EVENT_LIGHT_HIGH" |
	"EVENT_LIGHT_NORMAL" |
	"EVENT_LIGHT_LOW" |
	"EVENT_LIGHT_CLICK" |
	"EVENT_LIGHT_DOUBLECLICK" |
	"EVENT_COUNTER_0" |
	"EVENT_COUNTER_1" |
	"EVENT_TIMER_0" |
	"EVENT_TIMER_1" |
	"EVENT_TIMER_2" |
	"EVENT_MESSAGE" |
	"CMD_TYPE_MASK" |
	"CMD_TYPE_FIRE" |
	"CMD_FIRE_ELECTRONET" |
	"CMD_FIRE_LASER" |
	"CMD_FIRE_SPINNER" |
	"CMD_FROM_RCX2" |
	"CMD_TYPE_GAME" |
	"CMD_GAME_BLINK" |
	"CMD_GAME_COMMAND" |
	"CMD_GAME_GETVAR" |
	"CMD_GAME_GIVE" |
	"CMD_GAME_LOSE" |
	"CMD_GAME_START" |
	"CMD_GAME_TAKE" |
	"CMD_GAME_VALUE" |
	"CMD_GAME_WIN" |
	"CMD_TYPE_REACT_TO" |
	"CMD_REACT_TO_GIGAMESH" |
	"CMD_REACT_TO_SHADOWSTRIKE" |
	"CMD_REACT_TO_SNAPTRAX" |
	"CMD_REACT_TO_TECHNOJAW" |
	"CMD_TYPE_TELL" |
	"CMD_TELL_DIZZY" |
	"CMD_TELL_FLASHBLIND" |
	"CMD_TELL_FREEZE" |
	"CMD_TELL_MAGNET" |
	"CMD_TELL_REPULSE" |
	"CMD_TELL_REVERSE" |
	"CMD_TELL_SLOW" |
	"CMD_TELL_TAKECONTROL" |
	"CMD_TYPE_SPARE" |
	"CMD_SMART_BOMB" |
	"CMD_TYPE_USER" |
	"CMD_TYPE_VLL" |
	"MSG_BROADCAST" |
	"MSG_DIRECT" |
	"MSG_LINKCAST" |
	"RC_CHANNEL_1" |
	"RC_CHANNEL_2" |
	"RC_CHANNEL_3" |
	"RC_CMD_FLOAT" |
	"RC_CMD_FWD" |
	"RC_CMD_OFF" |
	"RC_CMD_REV" |
	"SCOUT_MODE_POWER" |
	"SCOUT_MODE_STANDALONE" |
	"SPY_CTRL_BTN_1" |
	"SPY_CTRL_BTN_2" |
	"SPY_CTRL_BTN_3" |
	"SPY_CTRL_BTN_4" |
	"SPY_CTRL_BTN_5" |
	"SPY_CTRL_RCX_1" |
	"SPY_CTRL_RCX_2" |
	"SPY_CTRL_RCX_3" |
	"SPY_CTRL_RCX_4" |
	"SPY_CTRL_RCX_5" |
	"SPY_CTRL_RCX_6" |
	"SPY_CTRL_RCX_7" |
	"SPY_CTRL_RCX_8" |
	"UART_BOT" |
	"UART_CTRL" |
	"UART_PING" |
	"UART_RC" |
	"LED_MODE_ON" |
	"LED_MODE_BLINK" |
	"LED_MODE_DURATION" |
	"LED_MODE_SCALE" |
	"LED_MODE_SCALE_BLINK" |
	"LED_MODE_SCALE_DURATION" |
	"LED_MODE_RED_SCALE" |
	"LED_MODE_RED_SCALE_BLINK" |
	"LED_MODE_GREEN_SCALE" |
	"LED_MODE_GREEN_SCALE_BLINK" |
	"LED_MODE_YELLOW" |
	"LED_MODE_YELLOW_BLINK" |
	"LED_MODE_YELLOW_DURATION" |
	"LED_MODE_VLL" |
	"LED_MODE_VLL_BLINK" |
	"LED_MODE_VLL_DURATION" |
	"ANIMATION_SCAN" |
	"ANIMATION_SPARKLE" |
	"ANIMATION_FLASH" |
	"ANIMATION_RED_TO_GREEN" |
	"ANIMATION_GREEN_TO_RED" |
	"ANIMATION_POINT_FORWARD" |
	"ANIMATION_ALARM" |
	"ANIMATION_THINKING" |
	"LIGHT_ON" |
	"LIGHT_OFF" |
	"SERIAL_TYPE" |
	"SERIAL_TYPE_SPYBOT" |
	"SERIAL_TYPE_RCX" |
	"SERIAL_TYPE_RC" |
	"SERIAL_TYPE_USER" |
	"SERIAL_BAUD" |
	"SERIAL_BAUD_2400" |
	"SERIAL_BAUD_4800" |
	"SERIAL_BAUD_9600" |
	"SERIAL_CHANNEL" |
	"SERIAL_CHANNEL_IR" |
	"SERIAL_CHANNEL_PC" |
	"SERIAL_PREAMBLE_POS" |
	"SERIAL_PREAMBLE_LEN" |
	"SERIAL_CHECKSUM" |
	"SERIAL_CHECKSUM_NONE" |
	"SERIAL_CHECKSUM_SUM" |
	"SERIAL_CHECKSUM_ZERO_SUM" |
	"SERIAL_BIPHASE" |
	"SERIAL_BIPHASE_OFF" |
	"SERIAL_BIPHASE_ON" |
	"MSG_NONE" |
	"MSG_IR" |
	"MSG_PC" |
	"MSG_INDEX" |
	"MSG_COMMAND" |
	"MSG_HI_BYTE" |
	"MSG_LO_BYTE" |
	"COMMAND_CONTROLLER" |
	"INDEX_LINKCAST" |
	"INDEX_BROADCAST" |
	"INDEX_INVALID" |
	"TARGET_NONE" |
	"ID_NONE" |
	"ID_CTRL1" |
	"ID_CTRL2" |
	"ID_CTRL3" |
	"ID_CTRL4" |
	"ID_CTRL5" |
	"ID_CTRL6" |
	"ID_PC" |
	"ID_BOT_MIN" |
	"ID_BOT_MAX" |
	"RANGE_NOWHERE" |
	"RANGE_ANYWHERE" |
	"RANGE_THERE" |
	"RANGE_HERE" |
	"DIRECTION_LEFT" |
	"DIRECTION_LEFT_OF_CENTER" |
	"DIRECTION_CENTER" |
	"DIRECTION_RIGHT_OF_CENTER" |
	"DIRECTION_RIGHT" |
	"ASPECT_FRONT_LEFT" |
	"ASPECT_FRONT" |
	"ASPECT_FRONT_RIGHT" |
	"ASPECT_BACK_RIGHT" |
	"ASPECT_BACK" |
	"ASPECT_BACK_LEFT" |
	"SPY_TARGETID" |
	"SPY_NOTE" |
	"SPY_LINKID" |
	"SPY_RANGE" |
	"SPY_DIRECTION" |
	"SPY_ASPECT" |
	"SPY_INFO" |
	"SPY_SHORTID" |
	"REL_GT" |
	"REL_LT" |
	"REL_EQ" |
	"REL_NE" |
	"TIMER_RUNNING" |
	"TIMER_STOPPED" |
	"RC_CHANNEL_BROADCAST" |
	"RC_CHANNEL_1" |
	"RC_CHANNEL_2" |
	"RC_CHANNEL_3" |
	"RC_CHANNEL_DISABLED" |
	"CONTROLLER_BUTTON1" |
	"CONTROLLER_BUTTON2" |
	"CONTROLLER_BUTTON3" |
	"CONTROLLER_BUTTON4" |
	"CONTROLLER_BUTTON5" |
	"RCTXMODE_SINGLE_SHOT" |
	"RCTXMODE_CONTINUOUS" |
	"MOVE_BASIC" |
	"MOVE_RANDOM" |
	"MOVE_FANCY" |
	"MOVE_SLOWDOWN" |
	"MOVE_SPEEDUP" |
	"MOVE_MASK" |
	"MOVE_TYPE_MASK" |
	"MOVE_BASIC_FORWARD" |
	"MOVE_BASIC_BACKWARD" |
	"MOVE_BASIC_SPIN_LEFT" |
	"MOVE_BASIC_SPIN_RIGHT" |
	"MOVE_BASIC_TURN_LEFT" |
	"MOVE_BASIC_TURN_RIGHT" |
	"MOVE_BASIC_AVOID_LEFT" |
	"MOVE_BASIC_AVOID_RIGHT" |
	"MOVE_BASIC_REST" |
	"MOVE_BASIC_STOP" |
	"MOVE_RANDOM_FORWARD" |
	"MOVE_RANDOM_BACKWARD" |
	"MOVE_RANDOM_SPIN_LEFT" |
	"MOVE_RANDOM_SPIN_RIGHT" |
	"MOVE_RANDOM_TURN_LEFT" |
	"MOVE_RANDOM_TURN_RIGHT" |
	"MOVE_RANDOM_REST" |
	"MOVE_FANCY_ZIGZAG" |
	"MOVE_FANCY_SHAKE" |
	"MOVE_FANCY_SCAN" |
	"MOVE_FANCY_STEP" |
	"MOVE_FANCY_STEP_BACK" |
	"MOVE_FANCY_SEARCH" |
	"MOVE_FANCY_FAKE_LEFT" |
	"MOVE_FANCY_RAKE_RIGHT" |
	"MOVE_FANCY_BUG_FORWARD" |
	"MOVE_FANCY_LAZY" |
	"MOVE_FANCY_WALK" |
	"MOVE_FANCY_WALK_BACK" |
	"MOVE_FANCY_DANCE" |
	"MOVE_SLOWDOWN_FORWARD" |
	"MOVE_SLOWDOWN_BACKWARD" |
	"MOVE_SLOWDOWN_SPIN_LEFT" |
	"MOVE_SLOWDOWN_SPIN_RIGHT" |
	"MOVE_SPEEDUP_FORWARD" |
	"MOVE_SPEEDUP_BACKWARD" |
	"MOVE_SPEEDUP_SPIN_LEFT" |
	"MOVE_SPEEDUP_SPIN_RIGHT" |
	"SOUND_NONE" |
	"SOUND_SHOCKED" |
	"SOUND_FIRE_LASER" |
	"SOUND_FIRE_ELECTRONET" |
	"SOUND_FIRE_SPINNER" |
	"SOUND_HIT_BY_LASER" |
	"SOUND_HIT_BY_ELECTRONET" |
	"SOUND_HIT_BY_SPINNER" |
	"SOUND_TAG" |
	"SOUND_CRASH" |
	"SOUND_FIGHT" |
	"SOUND_GOT_IT" |
	"SOUND_GENERAL_ALERT" |
	"SOUND_OUT_OF_ENERGY_ALERT" |
	"SOUND_LOW_ENERGY_ALERT" |
	"SOUND_SCORE_ALERT" |
	"SOUND_TIME_ALERT" |
	"SOUND_PROXIMITY_ALERT" |
	"SOUND_DANGER_ALERT" |
	"SOUND_BOMB_ALERT" |
	"SOUND_FINAL_COUNTDOWN" |
	"SOUND_TICK_TOCK" |
	"SOUND_GOTO" |
	"SOUND_SCAN" |
	"SOUND_POINT_TO" |
	"SOUND_ACTIVATE_SHIELDS" |
	"SOUND_ACTIVATE_REFLECT" |
	"SOUND_ACTIVATE_CLOAK" |
	"SOUND_ACTIVATE_FLASH_BLIND" |
	"SOUND_MAGNET" |
	"SOUND_QUAD_DAMAGE" |
	"SOUND_REPULSE" |
	"SOUND_TURBO" |
	"SOUND_FREEZE" |
	"SOUND_SLOW" |
	"SOUND_REVERSE" |
	"SOUND_DIZZY" |
	"SOUND_BOOST" |
	"SOUND_DEACTIVATE_SHIELDS" |
	"SOUND_DEACTIVATE_REFLECT" |
	"SOUND_DEACTIVATE_CLOAK" |
	"SOUND_REFLECT" |
	"SOUND_EXPLOSION" |
	"SOUND_BIG_EXPLOSION" |
	"SOUND_PLACE_BOMB" |
	"SOUND_HIT_BY_WIND" |
	"SOUND_OUCH" |
	"SOUND_GEIGER" |
	"SOUND_WHISTLE" |
	"SOUND_IM_IT" |
	"SOUND_HELP" |
	"SOUND_SIREN" |
	"SOUND_BURNT" |
	"SOUND_GRINDED" |
	"SOUND_SMACKED" |
	"SOUND_TRILL_UP" |
	"SOUND_TRILL_DOWN" |
	"SOUND_YELL" |
	"SOUND_WHISPER" |
	"LED_RED1" |
	"LED_RED2" |
	"LED_RED3" |
	"LED_GREEN1" |
	"LED_GREEN2" |
	"LED_GREEN3" |
	"LED_YELLOW" |
	"LED_ALL_RED" |
	"LED_ALL_GREEN" |
	"LED_ALL_RED_GREEN" |
	"LED_ALL" |
	"EEPROM_MOTORCONTROL" |
	"EEPROM_SPECIES" |
	"EEPROM_LONGID" |
	"EEPROM_USERLEVEL" |
	"EEPROM_DEFAULTPINGRATE" |
	"EEPROM_RUNS" |
	"EEPROM_WINS" |
	"EEPROM_LOSSES" |
	"EEPROM_POINTS" |
	"EEPROM_PLAYSECONDS" |
	"EEPROM_TOTALPLAYTIME" |
	"EEPROM_MAXBOTS" |
	"EEPROM_MISSIONID" |
	"EEPROM_MISSIONSPLAYED" |
	"EEPROM_MISSIONPOINTS" |
	"EEPROM_HIGHSCORE" |
	"EEPROM_ROBOTNAME" |
	"EEPROM_BIRTHDATE" |
	"EEPROM_BOTDATA" |
	"EEPROM_STATUS" |
	"EEPROM_FIRSTTOKEN" |
	"EEPROM_LASTTOKEN" |
	"EEPROM_MAXTOKENS" |
	"MOTORCONTROL_NORMALSPEEDMASK" |
	"MOTORCONTROL_SLOWSPEEDMASK" |
	"MOTORCONTROL_LEFTDIR" |
	"MOTORCONTROL_RIGHTDIR" |
	"SPECIES_GIGAMESH" |
	"SPECIES_SNAPTRAX" |
	"SPECIES_SHADOWSTRIKE" |
	"SPECIES_TECHNOJAW" |
	"STATUS_INITIALIZING" |
	"STATUS_DOWNLOADING" |
	"STATUS_LOCKED" |
	"BATTERY_MAX" |
	"BATTERY_LOW" |
	"BATTERY_MIN" |
	"CLR_BREAKPOINTS" |
	"CLR_DATALOG" |
	"CLR_EVENTS" |
	"CLR_INPUTS" |
	"CLR_TASK_STACK" |
	"CLR_TIMERS" |
	"CLR_VARIABLES" |
	"DISPLAY_EXCEPTION" |
	"ES_ABOVE_UPPER" |
	"ES_BELOW_LOWER" |
	"ES_BETWEEN" |
	"ES_UNDETERMINED" |
	"EST_COUNTER_1" |
	"EST_COUNTER_2" |
	"EST_COUNTER_3" |
	"EST_INFRARED_STATUS" |
	"EST_LAST_IR_MSG" |
	"EST_SENSOR_1" |
	"EST_SENSOR_2" |
	"EST_SENSOR_3" |
	"EST_SENSOR_UNUSED" |
	"EST_TIMER_1" |
	"EST_TIMER_2" |
	"EST_TIMER_3" |
	"EST_TIMER_4" |
	"EST_USER_EVENT_0" |
	"EST_USER_EVENT_1" |
	"EST_USER_EVENT_2" |
	"EST_USER_EVENT_3" |
	"EST_USER_EVENT_4" |
	"EST_VIRTUAL_MOTOR" |
	"EST_VIRTUAL_SENSOR" |
	"EST_WAIT_FOR_MSG" |
	"EVENT_TYPE_4" |
	"EVENT_TYPE_5" |
	"EVENT_TYPE_6" |
	"EVENT_TYPE_INFRARED_IDLE" |
	"EVENT_TYPE_RESET" |
	"EVENT_TYPE_VIRTUAL_MOTOR_CHANGE" |
	"EVENT_TYPE_VIRTUAL_MOTOR_POWER" |
	"EVENT_TYPE_VIRTUAL_SENSOR_DEF" |
	"FMT_HHMM" |
	"FMT_MMSS" |
	"FMT_MSSTENTHS" |
	"IRM_ACCEPT_ALL" |
	"IRM_ACCEPT_USER" |
	"IRM_DISCARD" |
	"MAX_VOLUME" |
	"MPD_FLOAT" |
	"MPD_FWD" |
	"MPD_OFF" |
	"MPD_REV" |
	"MS_BRAKE" |
	"MS_FLOAT" |
	"MS_FWD" |
	"MS_REV" |
	"MTR_A" |
	"MTR_B" |
	"MTR_BRAKE_POWER_1" |
	"MTR_BRAKE_POWER_2" |
	"MTR_BRAKE_POWER_3" |
	"MTR_BRAKE_POWER_4" |
	"MTR_BRAKE_POWER_5" |
	"MTR_BRAKE_POWER_6" |
	"MTR_BRAKE_POWER_7" |
	"MTR_BRAKE_POWER_8" |
	"MTR_C" |
	"MTR_D" |
	"MTR_E" |
	"MTR_F" |
	"MTR_FLOAT_POWER_1" |
	"MTR_FLOAT_POWER_2" |
	"MTR_FLOAT_POWER_3" |
	"MTR_FLOAT_POWER_4" |
	"MTR_FLOAT_POWER_5" |
	"MTR_FLOAT_POWER_6" |
	"MTR_FLOAT_POWER_7" |
	"MTR_FLOAT_POWER_8" |
	"MTR_FWD_POWER_1" |
	"MTR_FWD_POWER_2" |
	"MTR_FWD_POWER_3" |
	"MTR_FWD_POWER_4" |
	"MTR_FWD_POWER_5" |
	"MTR_FWD_POWER_6" |
	"MTR_FWD_POWER_7" |
	"MTR_FWD_POWER_8" |
	"MTR_REV_POWER_1" |
	"MTR_REV_POWER_2" |
	"MTR_REV_POWER_3" |
	"MTR_REV_POWER_4" |
	"MTR_REV_POWER_5" |
	"MTR_REV_POWER_6" |
	"MTR_REV_POWER_7" |
	"MTR_REV_POWER_8" |
	"OUT_D" |
	"OUT_E" |
	"OUT_F" |
	"SENSOR_TYPE_ACTIVE_RAW" |
	"SERIAL_COMM_9600" |
	"SLS_RECEIVING_MSG" |
	"SLS_TRANSMITTING" |
	"SLS_UNKNOWN" |
	"SLS_WAIT_FOR_MSG" |
	"SMOTOR_FWD" |
	"SOUND_EXCEPTION" |
	"SOUND_SHORT_BLIP" |
	"SYS_BATTERY_LEVEL" |
	"SYS_COMM_ERRORS_FRAMING" |
	"SYS_COMM_ERRORS_OVERRUN" |
	"SYS_COMM_ERRORS_PARITY" |
	"SYS_COMM_ERRORS_TIMEOUT" |
	"SYS_CURRENT_TASK" |
	"SYS_DATALOG_SIZE" |
	"SYS_DEBUG_TASK_MODE" |
	"SYS_DEFAULT_TASK_STACK_SIZE" |
	"SYS_EXPANDED_RC_MESSAGES" |
	"SYS_EXPANDED_SUBROUTINES" |
	"SYS_FLOAT_DURING_INACTIVE_PWM" |
	"SYS_IGNORE_MESSAGES_CPU" |
	"SYS_INTER_CHAR_TIMEOUT" |
	"SYS_LCD_REFRESH_RATE" |
	"SYS_MEMORY_MAP_ADDRESS" |
	"SYS_MOTOR_TRANSITION_DELAY" |
	"SYS_NO_POWER_DOWN_ON_AC" |
	"SYS_OPCODES_PER_TIMESLICE" |
	"SYS_PLAY_SOUNDS" |
	"SYS_POWER_DOWN_DELAY" |
	"SYS_PREAMBLE_SIZE" |
	"SYS_QUEUED_SOUND_COUNT" |
	"SYS_ROT_DEBOUNCED_GLITCHES" |
	"SYS_ROT_ERRORS_COUNT" |
	"SYS_SENSOR_DELAY_CYCLES" |
	"SYS_SENSOR_MISSED_CONVERSIONS" |
	"SYS_SENSOR_REFRESH_RATE" |
	"SYS_SENSOR_REFRESH_STATE" |
	"SYS_SENSOR_SCAN_COUNT" |
	"SYS_SENSOR_STARTUP_DELAY" |
	"SYS_SERIAL_LINK_STATUS" |
	"SYS_SOUND_PLAYING" |
	"SYS_TASK_ACQUIRE_PRIORITY" |
	"SYS_TASK_SCHEDULING_PRIORITY" |
	"SYS_TRANSMITTER_RANGE" |
	"SYS_UNSOLICITED_MESSAGES" |
	"SYS_VOLUME" |
	"SYS_WATCH_FORMAT" 		{ addToken(Token.RESERVED_WORD_2); }

	/* Standard-defined macros. */
	"__DATE__" |
	"__TIME__" |
	"__FILE__" |
	"__LINE__" |
	"__STDC__"				{ addToken(Token.PREPROCESSOR); }

	{LineTerminator}				{ addNullToken(); return firstToken; }

	{Identifier}					{ addToken(Token.IDENTIFIER); }

	{WhiteSpace}+					{ addToken(Token.WHITESPACE); }

	/* Preprocessor directives */
	"#"{WhiteSpace}*{PreprocessorWord}	{ addToken(Token.PREPROCESSOR); }

	/* String/Character Literals. */
	{CharLiteral}					{ addToken(Token.LITERAL_CHAR); }
	{UnclosedCharLiteral}			{ addToken(Token.ERROR_CHAR); /*addNullToken(); return firstToken;*/ }
	{ErrorUnclosedCharLiteral}		{ addToken(Token.ERROR_CHAR); addNullToken(); return firstToken; }
	{ErrorCharLiteral}				{ addToken(Token.ERROR_CHAR); }
	{StringLiteral}				{ addToken(Token.LITERAL_STRING_DOUBLE_QUOTE); }
	{UnclosedStringLiteral}			{ addToken(Token.ERROR_STRING_DOUBLE); addNullToken(); return firstToken; }
	{ErrorStringLiteral}			{ addToken(Token.ERROR_STRING_DOUBLE); }

	/* Comment Literals. */
	{MLCBegin}					{ start = zzMarkedPos-2; yybegin(MLC); }
	{LineCommentBegin}			{ start = zzMarkedPos-2; yybegin(EOL_COMMENT); }

	/* Separators. */
	"(" |
	")" |
	"[" |
	"]" |
	"{" |
	"}"							{ addToken(Token.SEPARATOR); }

	/* Operators. */
	{Trigraph} |
	"=" |
	"+" |
	"-" |
	"*" |
	"/" |
	"%" |
	"~" |
	"<" |
	">" |
	"<<" |
	">>" |
	"==" |
	"+=" |
	"-=" |
	"*=" |
	"/=" |
	"%=" |
	">>=" |
	"<<=" |
	"^" |
	"&" |
	"&&" |
	"|" |
	"||" |
	"?" |
	":" |
	"," |
	"!" |
	"++" |
	"--" |
	"." |
	","							{ addToken(Token.OPERATOR); }

	/* Numbers */
	{IntegerLiteral}				{ addToken(Token.LITERAL_NUMBER_DECIMAL_INT); }
	{HexLiteral}					{ addToken(Token.LITERAL_NUMBER_HEXADECIMAL); }
	{FloatLiteral}					{ addToken(Token.LITERAL_NUMBER_FLOAT); }
	{ErrorNumberFormat}				{ addToken(Token.ERROR_NUMBER_FORMAT); }

	/* Some lines will end in '\' to wrap an expression. */
	"\\"							{ addToken(Token.IDENTIFIER); }

	{ErrorIdentifier}				{ addToken(Token.ERROR_IDENTIFIER); }

	/* Other punctuation, we'll highlight it as "identifiers." */
	";"							{ addToken(Token.IDENTIFIER); }

	/* Ended with a line not in a string or comment. */
	<<EOF>>						{ addNullToken(); return firstToken; }

	/* Catch any other (unhandled) characters and flag them as bad. */
	.							{ addToken(Token.ERROR_IDENTIFIER); }

}

<MLC> {

	[^hwf\n\*]+					{}
	{URL}						{ int temp=zzStartRead; addToken(start,zzStartRead-1, Token.COMMENT_MULTILINE); addHyperlinkToken(temp,zzMarkedPos-1, Token.COMMENT_MULTILINE); start = zzMarkedPos; }
	[hwf]						{}

	\n							{ addToken(start,zzStartRead-1, Token.COMMENT_MULTILINE); return firstToken; }
	{MLCEnd}						{ yybegin(YYINITIAL); addToken(start,zzStartRead+1, Token.COMMENT_MULTILINE); }
	\*							{}
	<<EOF>>						{ addToken(start,zzStartRead-1, Token.COMMENT_MULTILINE); return firstToken; }

}


<EOL_COMMENT> {
	[^hwf\n]+				{}
	{URL}					{ int temp=zzStartRead; addToken(start,zzStartRead-1, Token.COMMENT_EOL); addHyperlinkToken(temp,zzMarkedPos-1, Token.COMMENT_EOL); start = zzMarkedPos; }
	[hwf]					{}
	\n						{ addToken(start,zzStartRead-1, Token.COMMENT_EOL); addNullToken(); return firstToken; }
	<<EOF>>					{ addToken(start,zzStartRead-1, Token.COMMENT_EOL); addNullToken(); return firstToken; }
}
